Skip to content

fix(lexer): compile the size guard on 32-bit targets - #2

Closed
onokonem wants to merge 1 commit into
mainfrom
fix/32-bit-lexer-overflow
Closed

onokonem wants to merge 1 commit into
mainfrom
fix/32-bit-lexer-overflow

Conversation

@onokonem

Copy link
Copy Markdown

Summary

math.MaxUint32 (4294967295) does not fit in a 32-bit int, so len(src) > math.MaxUint32 fails to compile on 32-bit targets — e.g. GOOS=linux GOARCH=arm GOARM=7, which downstream consumers (EasyP) cross-build in CI.

Compare through uint64 instead. Behaviour on 64-bit targets is unchanged (len(src) is non-negative and always ≤ MaxInt).

Verification

  • go build ./... — passes (amd64)
  • GOOS=linux GOARCH=arm GOARM=7 go build ./... — now passes (previously: math.MaxUint32 overflows int)
  • go test ./lexer/... — passes

This is the minimal isolated fix from the 32-bit item in #1; it carries none of that PR's semantic changes.

`math.MaxUint32` (4294967295) does not fit in a 32-bit `int`, so
`len(src) > math.MaxUint32` failed to compile on 32-bit targets
(e.g. linux/arm7). Compare through uint64 instead; behaviour on 64-bit
targets is unchanged because len(src) is always non-negative.

Verified: go build ./... and GOOS=linux GOARCH=arm GOARM=7 go build ./...;
go test ./lexer/...
@ZergsLaw

Copy link
Copy Markdown
Contributor

Superseded by #1 (which includes the identical 32-bit uint64(len(src)) fix in lexer/lexer.go plus a linux/arm7 CI build check), tagged as v0.1.0.

@ZergsLaw ZergsLaw closed this Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants